package com.xca.znb.model.impl;

import android.content.Context;

import com.xca.znb.database.UserDAO;
import com.xca.znb.entity.Goods;
import com.xca.znb.entity.Local;
import com.xca.znb.entity.NewsLetter;
import com.xca.znb.entity.Order;
import com.xca.znb.entity.User;
import com.xca.znb.model.imodel.IOrderMessage;

public class OrderMessageImpl implements IOrderMessage {
    private UserDAO userDAO ;
    public OrderMessageImpl(Context context){
        userDAO = new UserDAO(context);
    }

    @Override
    public Local getLocalById(int id) {
        return userDAO.getLocalById(id);
    }

    @Override
    public User getUserByPhone(String phone) {
        return userDAO.getUser(phone);
    }

    @Override
    public Goods getGoodsById(int id) {
        return userDAO.getGoodsById(id);
    }

    @Override
    public Order getOrderById(int id) {
        return userDAO.getOrderById(id);
    }

    @Override
    public void addNewsletter(String phone1, String phone2, String time) {
        userDAO.addNewsletter(phone1, phone2, time);
    }

    @Override
    public NewsLetter getNewsLetterByPhone(String phone1, String phone2) {
        return userDAO.getNewsletterByPhone(phone1, phone2);
    }

    @Override
    public void updateOrderType(int id, String type, String time) {
        userDAO.updateOrderType(id, type, time);
    }

    @Override
    public void insertAccount(String phone, double num, String type, String time_day, String time_sec) {
        userDAO.insertAccount(phone, num, type, time_day, time_sec);
    }
}
